﻿
using System;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using Abp.Application.Services.Dto;
using Abp.Extensions;
using KDS.Mes.Mes.PlanDetails;

namespace KDS.Mes.Mes.PlanDetails.EntityMapper.PlanDetails
{

	/// <summary>
    /// 详细计划信息的数据配置文件
    /// </summary>
    public class PlanDetailCfg : EntityTypeConfiguration<PlanDetail>
    {
		/// <summary>
        ///  构造方法[默认链接字符串< see cref = "MesDbContext" /> ]
        /// </summary>
		public PlanDetailCfg ()
		{
		            ToTable("PlanDetail", MesConsts.SchemaName.Basic);
 
      //todo: 需要将以下文件注入到MesDbContext中

  //		public IDbSet<PlanDetail> PlanDetails { get; set; }
   //		 modelBuilder.Configurations.Add(new PlanDetailCfg());




		    // Plan - 关系映射
			HasRequired(a => a.Plan).WithMany().HasForeignKey(c => c.PlanId).WillCascadeOnDelete(true);


		    // SeatPosition - 关系映射
			HasRequired(a => a.SeatPosition).WithMany().HasForeignKey(c => c.SeatPositionId).WillCascadeOnDelete(true);


		    // 座椅条码
			Property(a => a.SeatID).HasMaxLength(50);
		}
    }
}